Vw = {
		required: function(thisElement){ // validates field for required. Does not prevent submits
			thisJElement.data('error_required',true);
			thisJElement.attr('placeholder','required');
		},
		
		number: function(inputString) {
			return inputString.replace(/[^\d\.-]/g,"");
		},
			
		integer: function(inputString) {
			return inputString.replace(/[^\d\-]/g,"");
		},
	
		positive: function(inputString) {
			return inputString.replace(/[^\d\.]/g,"");
		},
		
		maximum: function(inputString,svWords) {
			//find the max number
			var max = "";
			var location = svWords.toLowerCase().indexOf('maximum');
			for(var i = location+7; i < svWords.length; i++){
				if(isNaN(svWords.charAt(i)) && svWords.charAt(i) != "."){
					break;
				} else {
					max += svWords.charAt(i);
				}
			}
			if(svWords.match(/integer/i)){
				max = Math.floor(max) + '';
			} 
			if(max != "" && +inputString > Number(max)){
				inputString = max;
				if(svWords.match(/money/i)){
					inputString = Number(inputString);
					inputString = inputString.toFixed(2);
				}
			}
			return inputString;
		},
		
		numberFocusout: function(inputString,svWords) {
			// remove multiple '.'
			var periodCount = inputString.split(/\./g).length-1;
			for (var i = 1; i < periodCount; i++) { 
				inputString = inputString.replace(".","");
			}
			// if '-' exists at all.  remove all and prepend string with it.
			var minusCount = inputString.split(/\-/g).length-1;
			if(minusCount > 0){
				for (var i = 0; i < minusCount; i++) { 
					inputString = inputString.replace("-","");
				}
				inputString = '-' + inputString;
				if(inputString == '-'){
					inputString = '';
				}
			}
			if(inputString == '.'){
				inputString = '';
			}
			return inputString;
		},
		
		moneyFocusout: function(inputString) { // do not allow blanks
			if(inputString.length > 0) {
				inputString = Number(inputString).toFixed(2);
			}
			return inputString;
		},
		
		maxlength: function(inputString,svWords){
			//find the max number
			var max = "";
			var location = svWords.toLowerCase().indexOf('maxlength');
			for(var i = location+9; i < svWords.length; i++){
				if(isNaN(svWords.charAt(i))){
					break;
				} else {
					max += svWords.charAt(i);
				}
			}
			if(max != "" && +inputString.length > Number(max)){
				inputString = inputString.substring(0,max);
			}
			return inputString;
		},
		
		emailFocusout: function(thisInput){
			var thisJInput = jQuery(thisInput);
			var inputString = thisJInput.val();
			if(inputString.split('@').length != 2 && inputString.split('.') != 2 && inputString != ""){
				thisJInput.data('error_format',true);
			} else {
				thisJInput.data('error_format',false);
			}
			return thisJInput.val()||"";
		}
};